//
//
//  Created by apple on 14-6-27.
//  Copyright (c) 2014年. All rights reserved.
//

#import <UIKit/UIKit.h>

static inline float fitFont(float font)
{
    float screenHeight =[UIScreen mainScreen].bounds.size.height;
    float iphone4H  = 480.0;
    float iphone5H  = 568.0;
    float iphone6H  = 667.0; //设计图
    float iphone6pH  = 736.0;
    
    float nfont = font;
    if (screenHeight == iphone4H) {//4
        nfont = font-1.5;
        
    }else if (screenHeight == iphone5H){//5
        nfont =font-1;
        
    }else if (screenHeight == iphone6H){//6
        nfont =font;
        
    }else if (screenHeight == iphone6pH){//6p
        nfont =font;
    }
    return nfont;
}
/** height（iphone6手机上高度） */
static inline float fitHeight(float height)
{
    float screenHeight =[UIScreen mainScreen].bounds.size.height;
    float iphone4H  = 480.0;
    float iphone5H  = 568.0;
    float iphone6H  = 667.0; //设计图
    float iphone6pH  = 736.0;
    
    float scale = height;
    if (screenHeight == iphone4H) {//4
        scale = (height * iphone4H) / iphone6H;
        
    }else if (screenHeight == iphone5H){//5
        scale =(height * iphone5H) / iphone6H;
        
    }else if (screenHeight == iphone6H){//6
        scale = (height * iphone6H) / iphone6H;
        
    }else if (screenHeight == iphone6pH){//6p
        scale = (height * iphone6pH) / iphone6H;
    }
    return scale;
}
/** width（iphone6手机上宽度） */
static inline float fitWidth(float width)
{
    float screenWidth =[UIScreen mainScreen].bounds.size.width;
    float iphone4W  = 320.0;
    float iphone5W  = 320.0;
    float iphone6W  = 375.0; //设计图
    float iphone6pW  = 414.0;
    float scale = width;
    if (screenWidth == iphone4W) {//4
        scale = (width * iphone4W) / iphone6W;
        
    }else if (screenWidth == iphone5W){//5
        scale =(width * iphone5W) / iphone6W;
        
    }else if (screenWidth == iphone6W){//6
        scale = (width * iphone6W) / iphone6W;
        
    }else if (screenWidth == iphone6pW){//6p
        scale = (width * iphone6pW) / iphone6W;
    }
    return scale;
}

@interface UIView (Extension)
@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat centerX;
@property (nonatomic, assign) CGFloat centerY;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGFloat maxX;
@property (nonatomic, assign) CGFloat maxY;


/** 让控件抖动  */
-(void)shake;
/**
 给view添加阴影和圆角
 */
- (void)addShadowAndFillet;
/**
 给collectionViewCell添加圆角阴影：
 */
-(void)addShadowForCollectionViewCell;


@end
